<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-cascades"></i> 订单细则
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">

      <el-table
          :data="tableData"
          border
          class="table"
          ref="multipleTable"

      >
        <el-table-column prop="order_details_id" label="细则编号" align="center" ></el-table-column>
        <el-table-column prop="order_id" label="运输日期" align="center"></el-table-column>
        <el-table-column prop="goods_id" label="是否供货" align="center"></el-table-column>
        <el-table-column prop="order_details_number" label="运输要求" align="center"></el-table-column>
        <el-table-column prop="factory_id" label="重量" align="center"></el-table-column>
        <el-table-column prop="order_sum_money" label="总金额" align="center"></el-table-column>
        <el-table-column label="操作" width="300" align="center">
          <template slot-scope="scope">

            <el-button
                type="text"
                icon="el-icon-delete"
                class="red"
                @click="handleDelete(scope.row)"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

  </div>


</template>

<script>
import {
  fetchgetdetails,
  detailsdelete
} from '../index';
export default {
  name: 'basetable',
  data() {
    return {
      query: {
        address: '',
        name: '',
        pageIndex: 1,
        pageSize: 10
      },
      tableData: [],
      tempgoodsData:{},
      orderData:{},
      multipleSelection: [],
      delList: [],
      addVisible: false,
      buyVisible: false,
      pageTotal: 0,
      form: {},
      idx: -1,
      id: -1
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      fetchgetdetails().then(res =>{console.info(res)
        this.tableData=res.data.value
      })
    },

    handleDelete(row){
      this.tempgoodsData = row
      detailsdelete(this.tempgoodsData).then(res=>{console.info(res)
        console.log(this.tempgoodsData)
        console.log(res)
        window.location.reload()
      })
    },

    delAllSelection() {
      const length = this.multipleSelection.length;
      let str = '';
      this.delList = this.delList.concat(this.multipleSelection);
      for (let i = 0; i < length; i++) {
        str += this.multipleSelection[i].name + ' ';
      }
      this.$message.error(`删除了${str}`);
      this.multipleSelection = [];
    },
  }
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 20px;
}

.handle-select {
  width: 120px;
}

.handle-input {
  width: 300px;
  display: inline-block;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.mr10 {
  margin-right: 10px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
